package Text21;

import java.util.*;

public class Main {
    static int N = 110, n, ha, la, hb, lb;
    static char[][] g = new char[N][N];
    static boolean[][] st = new boolean[N][N];
    static int[] dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T-- > 0) {
            n = in.nextInt();
            for (int i = 0; i < n; i++) {
                g[i] = in.next().toCharArray();
            }
            for (int i = 0; i < n; i++) {
                Arrays.fill(st[i], false);
            }
            ha = in.nextInt();
            la = in.nextInt();
            hb = in.nextInt();
            lb = in.nextInt();
            boolean ans=dfs(ha,la);
            if(ans){
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }

    private static boolean dfs(int x, int y) {
        if (g[x][y] == '#') {
            return false;
        }
        if (x == hb && y == lb) {
            return true;
        }
        st[x][y] = true;
        for (int i = 0; i < 4; i++) {
            int a = x + dx[i];
            int b = y + dy[i];
            if (a < 0 || a >= n || b < 0 || b >= n) {
                continue;
            }
            if (st[a][b]) {
                continue;
            }
            if (dfs(a, b)) {
                return true;
            }
        }
        return false;
    }
}
